﻿(function () {
    NSFile("Gianduia.AppKit.NSInput");
    NSImport("Gianduia.AppKit.NSDynamicElement");
    NSClass("Gianduia.AppKit.NSInput").Extends("Gianduia.AppKit.NSDynamicElement").Implements({
        elementTagName: function () {
            return "input"
        }, elementType: NSProperty({
            setterImplementation: function (A) {
                if (this._elementType !== A) {
                    this._elementType = A;
                    this.setElementValueForKey(A, "type")
                }
            }
        }), elementName: NSProperty({
            setterImplementation: function (A) {
                if (this._elementName !== A) {
                    this._elementName = A;
                    this.setElementValueForKey(A, "name")
                }
            }, defaultValue: ""
        }), elementValue: NSProperty({
            setterImplementation: function (A) {
                this._elementValue = A;
                this.setElementValueForKey(A, "value")
            }
        }), cancelEvent: NSProperty({
            defaultValue: true
        }), shouldCreateElementFromElement: function (B) {
            var A = this.elementType();
            return (this._super("shouldCreateElementFromElement")(B) && (!B.type || (A && (B.type.uppercaseString() !== A.uppercaseString()))))
        }, createElement: function () {
            var C = document.createElement(this.elementTagName()), B = this.elementType(), A = this.elementName();
            if (B != null) {
                C.setAttribute("type", B)
            } if (A != null) {
                C.setAttribute("name", A)
            } return C
        }, shouldCancelEventForActionNamed: function (B, A) {
            if (this._cancelEvent) {
                return true
            } else {
                return false
            }
        }
    })
})();
